"""
    将数据从txt文件提取出来，放到excel表中
"""
from itertools import count

import openpyxl

file = open(r"C:\Users\suyujie\Desktop\测试数据\接口测试用例数据\更新用户信息接口测试用例.txt",'r',encoding='utf-8')
data = file.readlines()
workbook = openpyxl.load_workbook(r"C:\Users\suyujie\Desktop\测试数据.xlsx")
sheeet = workbook['更新用户信息']
# ch,us,pa,co=1,2,3,4
# print(len(data))
for i in range(2,len(data)+2):
    # print(i)
    list = data[i-2].split(';')
    sheeet.cell(i,1).value = list[0]#产品id
    sheeet.cell(i,2).value = list[1]#用户id
    sheeet.cell(i,3).value = list[2]#密码
    sheeet.cell(i,4).value = list[3]#预期响应码
    sheeet.cell(i,5).value = list[4]#产品id
    sheeet.cell(i,6).value = list[5]#用户id
    sheeet.cell(i,7).value = list[6]#密码
    # print(data[i].count(';'),i-1)
    # print(data[16].split(';'))
workbook.save(r"C:\Users\suyujie\Desktop\测试数据.xlsx")
file.close()
workbook.close()